<template>
	<view class="mydealdetail">
		<deviceheader :devicedata="devicedetailData">
			<view v-if="myData.type==0 && myData.dealtype==1" class="statusText"
			 :class="infoData.first_audit_status==2?'bluefont':'redfont'">
				{{infoData.first_audit_status==2?'审核成功':'审核失败'}}
			</view>
			<view v-if="myData.type==4" class="statusText"
			 :class="deal4.statusColor[infoData.status]">
				{{deal4.statusObj[infoData.status]}}
			</view>
		</deviceheader>
		<mydealdetailCom0 v-if="myData.type==0" :infoData="infoData" :dealtype="myData.dealtype"></mydealdetailCom0>
		<mydealdetailCom1 v-if="myData.type==1" :infoData="infoData" :dealtype="myData.dealtype"></mydealdetailCom1>
		<mydealdetailCom2 v-if="myData.type==2" :infoData="infoData" :dealtype="myData.dealtype"></mydealdetailCom2>
		<mydealdetailCom3 v-if="myData.type==3" :infoData="infoData" :dealtype="myData.dealtype"></mydealdetailCom3>
		<mydealdetailCom4 v-if="myData.type==4" :infoData="infoData"></mydealdetailCom4>
	</view>
</template>

<script>
	import { verifywaimaidetail,shoprateinfo,wmmodifyinfo,goodslist } from '../../api/index.js'
	import deviceheader from '../../components/sevice/deviceheader.vue'
	import mydealdetailCom0 from '../../components/sevice/mydeal/mydealdetailCom0.vue' //我处理的-外卖
	import mydealdetailCom1 from '../../components/sevice/mydeal/mydealdetailCom1.vue' //我处理的-费率
	import mydealdetailCom2 from '../../components/sevice/mydeal/mydealdetailCom2.vue' //我处理的-店铺
	import mydealdetailCom3 from '../../components/sevice/mydeal/mydealdetailCom3.vue' //我处理的-店铺
	import mydealdetailCom4 from '../../components/sevice/mydeal/mydealdetailCom4.vue' //我发起的
	
	export default {
		data() {
			return {
				devicedetailData:{
					img:'',
					shop_name:'',
					uid:'',
					shop_id:''
				},
				infoData:'',
				myData:'',
				deal4:{
					statusObj:{
						'1':'审核通过',
						'2':'审核失败',
						'0':'审核中'
					},
					statusColor:{
						'0':'orangefont',
						'1':'bluefont',
						'2':'redfont'
					}
				}
			}
		},
		onLoad:function(data){
			// console.log(data);
			this.myData = data;
			if(data.type == 0){ //我处理的-外卖
				this.getVerifywaimaidetail(data.id)
			}else if(data.type == 1 || data.type == 4){ //我处理的-费率 和 我发起的
				this.getShoprateinfo(data.id)
			}else if(data.type == 2){ //我处理的-店铺
				this.getWmmodifyinfo(data.id)
			}else if(data.type == 3){ //我处理的-菜品
				this.getGoodslist(data.id,data.dealtype)
			}
		},
		methods: {
			//我处理的-外卖详情
			getVerifywaimaidetail:function(id){
				let that = this;
				verifywaimaidetail({
					suid:id
				}).then((res) => {
					console.log(res)
					if(res.code == 0){
						that.infoData = res.data;
						that.devicedetailData = {
							img:res.data.logo_img,
							shop_name:res.data.shop_name,
							uid:res.data.uid,
							shop_id:res.data.suid
						}
					}
				}).catch((e) => {
					console.log(e);
				})
			},
			// 我处理的-费率详情 和 我发起的-详情
			getShoprateinfo:function(id){
				let that = this;
				shoprateinfo({
					id:id
				}).then((res) => {
					console.log(res)
					if(res.code == 0){
						that.infoData = res.data;
						that.devicedetailData = {
							img:res.data.img_audit,
							shop_name:res.data.shop_name,
							uid:res.data.uid,
							shop_id:res.data.suid
						}
					}
				}).catch((e) => {
					console.log(e);
				})
			},
			//我处理的-店铺详情
			getWmmodifyinfo:function(id){
				let that = this;
				wmmodifyinfo({
					id:id
				}).then((res) => {
					console.log(res)
					if(res.code == 0){
						that.infoData = res.data.info;
						that.devicedetailData = {
							img:res.data.info.logo_img,
							shop_name:res.data.info.shop_name,
							uid:res.data.info.uid,
							shop_id:res.data.info.suid
						}
					}
				}).catch((e) => {
					console.log(e);
				})
			},
			//我处理的-菜品详情
			getGoodslist:function(id,type){
				let that = this;
				goodslist({
					approval_form:id,
					type:parseInt(type)+1
				}).then((res) => {
					// console.log(res)
					if(res.code == 0){
						that.infoData = res.data;
						that.devicedetailData = {
							img:res.data.shop_info.logo_img,
							shop_name:res.data.shop_info.shop_name,
							uid:res.data.shop_info.uid,
							shop_id:res.data.shop_info.suid
						}
					}
				}).catch((e) => {
					console.log(e);
				})
			}
		},
		components:{
			deviceheader,
			mydealdetailCom0,
			mydealdetailCom1,
			mydealdetailCom2,
			mydealdetailCom3,
			mydealdetailCom4
		}
	}
</script>

<style lang="scss" scoped>
	.statusText{
		position: absolute;
		right: 30rpx;
		top: 60rpx;
	}
	// .mydealdetail{
	// 	.com{
	// 		height: 100%;
	// 		background-color: $uni-bg-color-grey;
	// 		font-size: $uni-font-size-base;
	// 		.content{
	// 			.list{
	// 				background-color: #FFFFFF;
	// 				margin-bottom: 30rpx;
	// 				padding: 0 30rpx;
	// 				.list_item{
	// 					display: flex;
	// 					justify-content: space-between;
	// 					padding: 30rpx 0;
	// 					border-bottom: 1rpx $uni-border-color-e5 solid;
	// 					.item_title{
	// 						color: #999999;
	// 					}
	// 					.item_text{
	// 						input{
	// 							font-size: $uni-font-size-base;
	// 							text-align: right;
	// 						}
	// 					}
	// 				}
	// 			}
	// 		}
	// 		.btn{
	// 			display: flex;
	// 			justify-content: space-between;
	// 			background-color: #FFFFFF;
	// 			padding: 30rpx;
	// 			button{
	// 				font-size: $uni-font-size-lg;
	// 				width: 45%;
	// 				&.btn_reject{
	// 					color: #007AFF;
	// 					background-color: #FFFFFF;
	// 					&:after{
	// 						border: 4rpx #007AFF solid;
	// 					}
	// 				}
	// 			}
	// 		}
	// 		.audit{
	// 			background-color: #FFFFFF;
	// 			.audit_title{
	// 				background-color: #F5F5F5;
	// 				padding: 30rpx 0 20rpx 20rpx;
	// 				color: #666666;
	// 				font-weight: bold;
	// 			}
	// 			.audit_con{
	// 				position: relative;
	// 				padding-left: 110rpx;
	// 				.audit_left{
	// 					position: absolute;
	// 					left: 72rpx;top: 86rpx;
	// 					width: 2rpx;
	// 					height: 84rpx;
	// 					background-color: #007AFF;
	// 					&:before{
	// 						content: '';
	// 						position: absolute;
	// 						width: 36rpx;
	// 						height: 36rpx;
	// 						border-radius: 100%;
	// 						border: 1rpx solid #007AFF;
	// 						left: -18px;
	// 						top: -40px;
	// 					}
	// 					&:after{
	// 						content: '';
	// 						position: absolute;
	// 						width: 36rpx;
	// 						height: 36rpx;
	// 						border-radius: 100%;
	// 						border: 1rpx solid #007AFF;
	// 						bottom: -40px;
	// 						left: -18px;
	// 					}
	// 				}
	// 				.audit_right{
	// 					padding: 20rpx 30rpx;
	// 					.greyfont{
	// 						color: #999999;
	// 						font-size: $uni-font-size-sm;
	// 					}
	// 					.right_step{
	// 						display: flex;
	// 						justify-content: space-between;
	// 						padding: 20rpx 0;
	// 						.rigth_stepTitle{
	// 							font-size: $uni-font-size-lg;
	// 							margin-bottom: 10rpx;
	// 						}
	// 					}
	// 				}
	// 			}
	// 		}
	// 	}
	// }
</style>
